<template>
<HeadSix :active-index="activeIndex"></HeadSix>
<el-row :gutter="20">
  <el-col :span="6">
      <el-card shadow="always" style="margin: 20px 0px 20px 40px">
        <el-row>
          <el-col :span="6">
            <el-icon color="#40c9c6" size="60"><UserFilled /></el-icon>
          </el-col>
          <el-col :span="18" class="flex justify-start items-center">
            <el-link @click="router.push(`/enterpriseinfo`)">
              <p class="text-xl">{{userInfo.auth.user.qymc}}</p>
            </el-link>
          </el-col>
        </el-row>
      </el-card>
  </el-col>
  <el-col :span="6">
    <el-card shadow="always" style="margin: 20px 0px 20px 40px">
      <el-row>
        <el-col :span="6">
          <el-icon color="#36a3f7" size="60"><UploadFilled /></el-icon>
        </el-col>
        <el-col :span="18" class="flex justify-start items-center">
          <el-link @click="router.push(`/proDuctCunzheng`)">
            <p class="text-xl">资质凭证：{{Info.All.evidence}}条</p>
          </el-link>
        </el-col>
      </el-row>
    </el-card>
  </el-col>
  <el-col :span="6">
    <el-card shadow="always" style="margin: 20px 0px 20px 0px">
      <el-row>
        <el-col :span="6">
          <el-icon color="#34bfa3" size="60"><Checked /></el-icon>
        </el-col>
        <el-col :span="18" class="flex justify-start items-center">
          <el-link @click="router.push(`/proDuctCunzheng`)">
            <p class="text-xl">资质上链凭证：{{Info.All.upLinkEvi}}条</p>
          </el-link>
        </el-col>
      </el-row>
    </el-card>
  </el-col>
  <el-col :span="6">
    <el-card shadow="always" style="margin: 20px 40px 20px 0px">
      <el-row>
        <el-col :span="6">
          <el-icon color="#f4516c" size="60"><TrendCharts /></el-icon>
        </el-col>
        <el-col :span="18" class="flex justify-start items-center">
          <el-link @click="router.push(`/jiaoyi`)">
            <p class="text-xl">交易上链凭证：{{Info.All.transaction}}条</p>
          </el-link>
        </el-col>
      </el-row>
    </el-card>
  </el-col>
</el-row>
<el-row>
  <el-col>
    <el-card style="margin: 0px 40px 0px 40px"></el-card>
  </el-col>
</el-row>
<el-row :gutter="20">
    <el-col :span="6">
      <el-card shadow="always" style="margin: 20px 0px 20px 40px">
        <el-row>
          <el-col :span="6">
            <el-icon color="#40c9c6" size="60"><FolderOpened /></el-icon>
          </el-col>
          <el-col :span="18" class="flex justify-start items-center">
            <el-link @click="router.push(`/upLoadProductInfo`)">
              <p class="text-xl">产品信息：{{Info.All.productInfo}}条</p>
            </el-link>
          </el-col>
        </el-row>
      </el-card>
    </el-col>
    <el-col :span="6">
      <el-card shadow="always" style="margin: 20px 0px 20px 40px">
        <el-row>
          <el-col :span="6">
            <el-icon color="#36a3f7" size="60"><Connection /></el-icon>
          </el-col>
          <el-col :span="18" class="flex justify-start items-center">
            <el-link @click="router.push(`/cpscInfo`)">
              <p class="text-xl">生成批次数量：{{Info.All.batchInfo}}条</p>
            </el-link>
          </el-col>
        </el-row>
      </el-card>
    </el-col>
    <el-col :span="6">
      <el-card shadow="always" style="margin: 20px 0px 20px 0px">
        <el-row>
          <el-col :span="6">
            <el-icon color="#40c9c6" size="60"><Van /></el-icon>
          </el-col>
          <el-col :span="18" class="flex justify-start items-center">
            <el-link @click="router.push(`/wlxx`)">
              <p class="text-xl">物流信息：{{Info.All.logistics}}条</p>
            </el-link>
          </el-col>
        </el-row>
      </el-card>
    </el-col>
    <el-col :span="6">
      <el-card shadow="always" style="margin: 20px 40px 20px 0px">
        <el-row>
          <el-col :span="6">
            <el-icon color="#f4516c" size="60"><Document /></el-icon>
          </el-col>
          <el-col :span="18" class="flex justify-start items-center">
            <el-link @click="router.push(`/jggc`)">
              <p class="text-xl">加工信息：{{Info.All.processing}}条</p>
            </el-link>
          </el-col>
        </el-row>
      </el-card>
    </el-col>
  </el-row>
<el-row>
    <el-col>
      <el-card style="margin: 0px 40px 20px 40px"></el-card>
    </el-col>
  </el-row>
<el-row :gutter="20">
  <el-col :span="12">
    <SimpleJy></SimpleJy>
  </el-col>
  <el-col :span="12">
    <el-card style="margin: 0px 40px 20px 0px">
      <cer-type-table
      ></cer-type-table>
    </el-card>
  </el-col>
</el-row>
</template>

<script setup>
import HeadSix from "@/components/header/headSix.vue"
import router from "@/router/index.js"
import {
  Checked,
  Connection,
  Document,
  FolderOpened,
  TrendCharts,
  UploadFilled,
  UserFilled,
  Van
} from "@element-plus/icons-vue"
import {useCountStore, useUserStore} from "@/stores/myStore.js"
import {getAllInfo, getOptionInfo, initTableInfo} from "@/api/methods/initInfo.js"
import {CntJyInfo, CntWlInfo, upJyInfo, upWlInfo} from "@/api/apiPath/fourPart.js"
import {onMounted, ref} from "vue"
import {CntCpInfo, upcpscInfo, upJcInfo} from "@/api/apiPath/twoPart.js"
import {CntProductInfo, upProductInfo} from "@/api/apiPath/onePartApi.js"
import Same from "@/pages/same.vue"
import SimpleJy from "@/pages/sixPart/SimpleJy.vue"
import CerTypeTable from "@/components/table/cerTypeTable.vue"
import {CntProEviInfo, countCerType, countUpLink, upProEviInfo} from "@/api/apiPath/sixPart.js"
import {CntJgInfo} from "@/api/apiPath/threePart.js";

const activeIndex = '/czshow'

const Info = useCountStore()
const userInfo = useUserStore()

const queryForm = ref({
  query: '',
  pageNum: 1,
  pageSize: 5,
  totalSize: 0
})
onMounted(async () => {
  try {
    const [logistics, productInfo, processing, batchInfo, transaction, evidence, upLinkEvi] = await Promise.all([
      getAllInfo(CntWlInfo()),
      getAllInfo(CntProductInfo()),
      getAllInfo(CntJgInfo()),
      getAllInfo(CntCpInfo()),
      getAllInfo(CntJyInfo()),
      getAllInfo(CntProEviInfo()),
      getAllInfo(countUpLink(userInfo.auth.user.qymc))
    ])

    Info.All.logistics = logistics
    Info.All.processing = processing
    Info.All.productInfo = productInfo
    Info.All.batchInfo = batchInfo
    Info.All.transaction = transaction
    Info.All.evidence = evidence
    Info.All.upLinkEvi = upLinkEvi
  } catch (e) {
    console.log(e)
  }
})
</script>

<style scoped>

</style>